home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Disc to the Future 2
/
Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin
/
MAC
/
MACSHELL
/
MS1
/
COMMANDS
/
RESOURCE.C
< prev
next >
Wrap
Text File
|
1992-12-02
|
24KB
|
1,046 lines
/*
* MacShell Source File
*
* Copyright (c) 1989, 1990, 1991, 1992 Suick Bay Technologies. All rights reserved.
*
*
* RESTRICTIONS ON MacShell program and source code.
*
* Ñ╩MacShell¬ is a product of Suick Bay Technologies and is provided for
* restricted use by the owner of the CDROM "Disk to the future II".
*
* Ñ╩No permission is granted for any commercial use without the written
* consent of the Suick Bay Technologies.
*
* Ñ╩No permission is granted for any redistribution of any kind use without
* the written consent of the Suick Bay Technologies.
*
* Ñ╩Permission is granted to use this for any personal noncommercial use.
*
* Ñ╩You may not distribute source or executable code at all, nor may you
* distribute it with or within a commercial product without the written
* consent of the Suick Bay Technologies. Please send modifications to
* the author for inclusion in updates to the program. Thanks.
*
*
* MacShell¬ IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
*
* SUICK BAY TECHNOLOGIES SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY MACSHELL
* OR ANY PART THEREOF.
*
* In no event will Suick Bay Technologies be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Suick Bay Technologies has been advised of the possibility of such damages.
*
* Suick Bay Technologies can be reached at:
*
* 8768 Cottonwood lane
* Maple Grove, MN 55369
* Voice: (612) 425-7025
* AppleLink: D5233
*
*
* No parts of this software may be reproduced or stored in a
* retrieval system or transmitted in any form, or any means,
* electronic, mechanical, photocopying, recording or otherwise,
* without the prior written permission of Suick Bay Technologies.
*
* Spread the word and not the disk.
*
* SPK 012290 : Initial
*
* cpr - copy resource
* mvr - move resource
* cmpr - compare resource
* rmr - remove resource
*
* grepr - resource search
*
*/
#include <ResourceMgr.h>
#include "SystemPub.h"
#include "Proc.h"
#include "ShellPub.h"
#include "Path.h"
/*******************************************************************/
#define f1Type (**MyShell).Proc[ProcID].long0
#define f2Type (**MyShell).Proc[ProcID].long1
#define f1ID (**MyShell).Proc[ProcID].int0
#define f2ID (**MyShell).Proc[ProcID].int1
int16 OpenResCmdFile( WHandle ShellWh, char *path, int16 *wasOpen )
{
int16 srcVref, failed = FALSE, srcFRefNum;
int32 srcDirID, temp;
pathType pt;
char sName[ 64 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
pt = SetCurrPath( path );
if( pt == pathIsFile )
{
strcpy( sName, GetLastScan() );
GetPWDInfo( &srcVref, &srcDirID, &temp );
CtoPstr( sName );
*wasOpen = FALSE;
if( ResFileOpen( sName, srcVref, srcDirID, &srcFRefNum ) )
{
*wasOpen = TRUE;
}
else
srcFRefNum = OpenResFile( sName );
}
else
failed = TRUE;
if( failed )
return( -1 );
else
return( srcFRefNum );
ResetShellPWD( ShellWh );
}
/*******************************************************************
*
* cpr file1 type1 id1 file2 [type2 [id2]]
*
*******************************************************************/
void CPRes( WHandle ShellWh, int16 ProcID, char *file1, char *file2 )
{
int16 err, currFile, srcWasOpen, dstWasOpen,
srcFRefNum, dstFRefNum, failed = FALSE;
Handle h;
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
currFile = CurResFile();
SetResLoad( FALSE );
srcFRefNum = OpenResCmdFile( ShellWh, file1, &srcWasOpen );
if( srcFRefNum != (-1) )
{
if( strcmp( file1, file2 ) == 0 )
{
dstFRefNum = srcFRefNum;
dstWasOpen = TRUE;
}
else
dstFRefNum = OpenResCmdFile( ShellWh, file2, &dstWasOpen );
if( dstFRefNum != (-1) )
{
UseResFile( srcFRefNum ); /* get the resource */
h = Get1Resource( f1Type, f1ID );
err = ResError();
if( h && !err )
{
LoadResource( h );
DetachResource( h );
UseResFile( dstFRefNum );
AddResource( h, f2Type, f2ID, "\p" ); /* we are blowing off the name */
WriteResource( h );
}
if( !dstWasOpen )
CloseResFile( dstFRefNum );
}
else
failed = TRUE;
if( !srcWasOpen )
CloseResFile( srcFRefNum );
}
else
failed = TRUE;
if( failed )
procPrintf( ShellWh, ProcID, "cpr : can't copy resource.\n" );
SetResLoad( TRUE );
UseResFile( currFile );
}
/*******************************************************************
*
* mvr file1 type1 id1 file2 [type2 [id2]]
*
*******************************************************************/
void MVRes( WHandle ShellWh, int ProcID, char *file1, char *file2 )
{
int16 err, currFile, srcWasOpen, dstWasOpen,
srcFRefNum, dstFRefNum, failed = FALSE;
Handle h;
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
currFile = CurResFile();
SetResLoad( FALSE );
srcFRefNum = OpenResCmdFile( ShellWh, file1, &srcWasOpen );
if( srcFRefNum != (-1) )
{
if( strcmp( file1, file2 ) == 0 )
{
dstFRefNum = srcFRefNum;
dstWasOpen = TRUE;
}
else
dstFRefNum = OpenResCmdFile( ShellWh, file2, &dstWasOpen );
if( dstFRefNum != (-1) )
{
UseResFile( srcFRefNum ); /* get the resource */
h = Get1Resource( f1Type, f1ID );
err = ResError();
if( h && !err )
{
LoadResource( h );
DetachResource( h );
UseResFile( dstFRefNum );
AddResource( h, f2Type, f2ID, "\p" ); /* we are blowing off the name */
err = ResError();
WriteResource( h );
err = ResError();
if( !err ) /* delete the original resource */
{
UseResFile( srcFRefNum ); /* get the resource */
h = Get1Resource( f1Type, f1ID );
if( h )
{
LoadResource( h );
RmveResource( h );
DisposHandle( h );
}
}
}
if( !dstWasOpen )
CloseResFile( dstFRefNum );
}
else
failed = TRUE;
if( !srcWasOpen )
CloseResFile( srcFRefNum );
}
else
failed = TRUE;
if( failed )
procPrintf( ShellWh, ProcID, "mvr : can't move resource.\n" );
SetResLoad( TRUE );
UseResFile( currFile );
}
/*******************************************************************
*
* cmpr file1 type1 id1 file2 [type2 [id2]]
*
*******************************************************************/
void CMPRes( WHandle ShellWh, int ProcID, char *file1, char *file2 )
{
int16 err, currFile, f1WasOpen, f2WasOpen,
f1FRefNum, f2FRefNum, failed = FALSE;
Handle h1, h2;
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
currFile = CurResFile();
SetResLoad( FALSE );
f1FRefNum = OpenResCmdFile( ShellWh, file1, &f1WasOpen );
if( f1FRefNum != (-1) )
{
if( strcmp( file1, file2 ) == 0 )
{
f2FRefNum = f1FRefNum;
f2WasOpen = TRUE;
}
else
f2FRefNum = OpenResCmdFile( ShellWh, file2, &f2WasOpen );
if( f2FRefNum != (-1) )
{
UseResFile( f1FRefNum ); /* get the resource */
h1 = Get1Resource( f1Type, f1ID );
err = ResError();
UseResFile( f2FRefNum ); /* get the resource */
h2 = Get1Resource( f2Type, f2ID );
err = ResError();
if( h1 && h2 ) /* compare the resources */
{
int32 len1, len2;
LoadResource( h1 );
LoadResource( h2 );
/* compare lengths */
len1 = SizeResource( h1 );
len2 = SizeResource( h2 );
if( len1 != len2 )
{
procPrintf( ShellWh, ProcID,
"cmpr : resources different sizes.\n" );
}
else
{
char *p1, *p2;
/* compare contents */
p1 = *h1; /* no need to lock since we are not */
p2 = *h2; /* going to call any toolbox functions */
while( len1 )
{
if( *p1 != *p2 )
{
procPrintf( ShellWh, ProcID,
"cmpr : %4X %4X at index %ld (%lX Hex)\n",
*p1, *p2, len2 -len1, len2 -len1 );
break;
}
p1++;
p2++;
len1--;
}
if( len1 == 0 )
procPrintf( ShellWh, ProcID,
"cmpr : resources match.\n" );
}
}
if( !f2WasOpen )
CloseResFile( f2FRefNum );
}
else
failed = TRUE;
if( !f1WasOpen )
CloseResFile( f1FRefNum );
}
else
failed = TRUE;
if( failed )
procPrintf( ShellWh, ProcID, "cmpr : can't compare resources.\n" );
SetResLoad( TRUE );
UseResFile( currFile );
}
/*******************************************************************
*
* Note DoRESCMD is the entry point for
*
* cpr, mvr, cmpr
*
*******************************************************************/
Boolean DoRESCMD( int16 ProcToken, WHandle ShellWh, int16 ProcID,
char *string )
{
int16 i, argc, argsOk = TRUE;
char *cp, argument[ 64 ], file1[ 64 ], file2[ 64 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
switch( ProcToken )
{
case PROC_INIT :
(**MyShell).Proc[ ProcID ].flags = TRUE;
break;
case PROC_TERM :
case PROC_BREAK :
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
break;
case PROC_STDIN :
if( (**MyShell).Proc[ ProcID ].flags )
{
(**MyShell).Proc[ ProcID ].flags = FALSE;
/* get arguments */
argc = (**MyShell).Proc[ ProcID ].argc;
*file1 = '\0';
*file2 = '\0';
f1Type = 0L;
f2Type = 0L;
f1ID = 0;
f2ID = 0;
if( argc < 4 )
{
argsOk = FALSE;
}
else
{
for( i = 1; i < argc && (argsOk == TRUE); i++ )
{
GetArgv( ShellWh, ProcID, i, argument );
switch( i )
{
case 1 :
strcpy( file1, argument );
break;
case 2 : /* file 1 type */
f1Type = StrToType( argument );
f2Type = f1Type;
break;
case 3 : /* file 1 ID */
CtoPstr( argument );
if( GoodNum( argument ) )
{
int32 tempVal;
StringToNum( argument, &tempVal );
f1ID = (int16) tempVal;
f2ID = f1ID;
}
else
argsOk = FALSE;
break;
case 4 :
if( strcmp( argument, "." ) == 0 )
strcpy( file2, file1 );
else
strcpy( file2, argument );
break;
case 5 : /* file 2 type */
f2Type = StrToType( argument );
break;
case 6 : /* file 2 ID */
CtoPstr( argument );
if( GoodNum( argument ) )
{
int32 tempVal;
StringToNum( argument, &tempVal );
f2ID = (int16) tempVal;
}
else
argsOk = FALSE;
break;
}
}
}
GetArgv( ShellWh, ProcID, 0, argument );
if( argsOk )
{
if( strcmp( argument, "cpr" ) == 0 )
CPRes( ShellWh, ProcID, file1, file2 );
else if( strcmp( argument, "mvr" ) == 0 )
MVRes( ShellWh, ProcID, file1, file2 );
else if( strcmp( argument, "cmpr" ) == 0 )
CMPRes( ShellWh, ProcID, file1, file2 );
}
else
procPrintf( ShellWh, ProcID,
"%s : bad arguments.\n", argument );
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
return( FALSE );
}
}
}
/*******************************************************************
*
* rmr file type [id]
*
*******************************************************************/
Boolean DoRMR( int16 ProcToken, WHandle ShellWh, int16 ProcID,
char *string )
{
int16 i, argc, argsOk = TRUE;
char *cp, argument[ 64 ], file1[ 64 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
switch( ProcToken )
{
case PROC_INIT :
(**MyShell).Proc[ ProcID ].flags = TRUE;
break;
case PROC_TERM :
case PROC_BREAK :
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
break;
case PROC_STDIN :
if( (**MyShell).Proc[ ProcID ].flags )
{
(**MyShell).Proc[ ProcID ].flags = FALSE;
/* get arguments */
argc = (**MyShell).Proc[ ProcID ].argc;
*file1 = '\0';
f1Type = 0L;
f1ID = 0;
if( argc < 2 )
{
argsOk = FALSE;
}
else
{
for( i = 1; i < argc && (argsOk == TRUE); i++ )
{
GetArgv( ShellWh, ProcID, i, argument );
switch( i )
{
case 1 :
strcpy( file1, argument );
break;
case 2 : /* file 1 type */
f1Type = StrToType( argument );
f2Type = f1Type;
break;
case 3 : /* file 1 ID */
CtoPstr( argument );
if( GoodNum( argument ) )
{
int32 tempVal;
StringToNum( argument, &tempVal );
f1ID = (int16) tempVal;
f2ID = f1ID;
}
else
argsOk = FALSE;
break;
}
}
}
if( argsOk )
{
int16 currFile, fRefNum, wasOpen, cnt;
Handle h;
currFile = CurResFile();
SetResLoad( FALSE );
fRefNum = OpenResCmdFile( ShellWh, file1, &wasOpen );
if( fRefNum != (-1) )
{
if( argc == 3 ) /* remove all of type */
{
cnt = Count1Resources( f1Type ) + 1;
while( --cnt )
{
h = Get1IndResource( f1Type, cnt );
if( h )
RmveResource( h );
}
}
else /* remove type, id */
{
h = Get1Resource( f1Type, f1ID );
if( h )
RmveResource( h );
}
if( !wasOpen )
CloseResFile( fRefNum );
SetResLoad( TRUE );
}
}
else
procPrintf( ShellWh, ProcID, "rmr : bad arguments.\n" );
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
return( FALSE );
}
}
}
/*******************************************************************
grepr [options] string files
grepr searchs resource files for resources that contain the specified
string. Resource TYPE, ID and offset are printed.
Patterns may be used in the files specification.
options
-t TYPE where TYPE is a 4 character file type
-i ID where ID is a decimal resource ID
*******************************************************************/
#define greprPatLen (**MyShell).Proc[ProcID].long0
#define greprResType (**MyShell).Proc[ProcID].long1
#define greprIndex (**MyShell).Proc[ProcID].long2
#define greprIDStart (**MyShell).Proc[ProcID].int0
#define greprIDEnd (**MyShell).Proc[ProcID].int1
#define greprCheckT (**MyShell).Proc[ProcID].int2
#define greprTypes (**MyShell).Proc[ProcID].bflags.f0
#define greprIDs (**MyShell).Proc[ProcID].bflags.f1
#define greprData (**MyShell).Proc[ProcID].bflags.f2
#define abortGrepr (**MyShell).Proc[ProcID].bflags.f3
extern char resName[],
resAttrStr[];
extern char grepPattern[];
/*******************************************************************/
Boolean BinaryMatch( Ptr base, Ptr check, int32 len )
{
while( len )
{
if( *base != *check )
break;
len--;
base++;
check++;
}
return( len == 0 );
}
Boolean greprHeadPrinted;
void grepResource( WHandle ShellWh, int16 ProcID, Handle h,
OsType theType, int16 resID, char *str )
{
Ptr b, p;
int32 totLen;
char typeStr[ 6 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
greprIndex = 0L;
MoveHHi( h );
HLock( h );
b = *h;
totLen = SizeResource( h ) - greprPatLen;
TypeToStr( theType, typeStr );
while( (totLen > 0) && !abortGrepr )
{
p = grepPattern;
if( BinaryMatch( b, p, greprPatLen ) )
{
if( !greprHeadPrinted )
{
procPrintf( ShellWh, ProcID,
"Offset TYPE ID Name\n--------------------------------\n" );
greprHeadPrinted = TRUE;
}
procPrintf( ShellWh, ProcID, "%5ld : %4s %5d %ps\n",
greprIndex, typeStr, resID, str );
}
greprIndex++;
totLen--;
b++;
}
HUnlock( h );
}
/*******************************************************************/
void greprType( WHandle ShellWh, int16 ProcID, OsType theType,
int16 numRes )
{
OsType aType;
int16 resID;
int32 resLoaded;
Handle h;
char str[ 64 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
while( --numRes && !abortGrepr )
{
h = Get1IndResource( theType, numRes );
if( h )
{
GetResInfo( h, &resID, &aType, str );
if( greprCheckT == 2 )
{
if( resID < greprIDStart )
continue;
else if( resID > greprIDEnd )
continue;
}
else if( greprCheckT == 1 )
if( resID != greprIDStart )
continue;
resLoaded = (int32) *h;
LoadResource( h );
grepResource( ShellWh, ProcID, h, aType, resID, str );
if( !resLoaded )
ReleaseResource( h );
}
if( UserAbort() )
abortGrepr = TRUE;
}
}
/*******************************************************************/
void greprName( WHandle ShellWh, int16 ProcID,
OsType theType, char *theName )
{
OsType aType;
Handle h;
char str[ 64 ];
int32 resLoaded;
int16 resID;
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
strcpy( str, theName );
CtoPstr( str );
h = Get1NamedResource( theType, str );
if( h )
{
GetResInfo( h, &resID, &aType, str );
if( greprCheckT == 2 )
{
if( resID < greprIDStart )
return;
else if( resID > greprIDEnd )
return;
}
else if( greprCheckT == 1 )
if( resID != greprIDStart )
return;
resLoaded = (int32) *h;
LoadResource( h );
grepResource( ShellWh, ProcID, h, aType, resID, str );
if( !resLoaded )
ReleaseResource( h );
}
}
/*******************************************************************/
void GREPRCallBack( WHandle ShellWh, int16 ProcID, char *path,
char *last, pathType what, int16 vRefNum, int32 dirID )
{
char str[ 256 ];
OSErr err;
int16 refNum, currFile, numTypes, numRes, resID,
resFileWasOpen = FALSE;
OsType theType, aType;
Handle h;
Boolean fileName = TRUE;
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
if( what == pathIsFile )
{
strcpy( str, last );
CtoPstr( str );
err = HSetVol( NULL, vRefNum, dirID );
if( err )
return;
currFile = CurResFile();
if( ResFileOpen( last, vRefNum, dirID, &refNum ) )
resFileWasOpen = TRUE;
else
refNum = OpenResFile( str );
if( refNum != (-1) )
{
greprHeadPrinted = FALSE;
UseResFile( refNum );
SetResLoad( FALSE );
numTypes = Count1Types() + 1;
while( --numTypes && !abortGrepr )
{
if( UserAbort() )
abortGrepr = TRUE;
Get1IndType( &theType, numTypes ); /* What type is this ? */
TypeToStr( theType, str );
numRes = Count1Resources( theType ) + 1;
if( greprResType && (greprResType != theType ) )
continue;
if( fileName )
{
procPrintf( ShellWh, ProcID, "grepr : %s\n", last );
fileName = FALSE;
}
if( *resName )
greprName( ShellWh, ProcID, theType, resName );
else
greprType( ShellWh, ProcID, theType, numRes );
}
if( !resFileWasOpen )
CloseResFile( refNum );
SetResLoad( TRUE );
UseResFile( currFile );
}
else if( (err = ResError()) && (err != eofErr) )
procPrintf( ShellWh, ProcID,
"grepr : error openning file %s (%d)\n", last, err );
}
}
/*******************************************************************/
void GREPRFile( WHandle ShellWh, int16 ProcID, char *argument )
{
ShellWindRec **MyShell;
MyShell = (ShellWindRec **) (**ShellWh).thing;
ExpandPath( ShellWh, ProcID, argument, (ProcPtr) GREPRCallBack,
(**MyShell).pwdVRefNum, (**MyShell).pwdDirID );
ResetShellPWD( ShellWh );
}
/*******************************************************************/
Boolean DoGREPR( int16 ProcToken, WHandle ShellWh, int16 ProcID,
char *string )
{
int16 i, argc, gotPattern = FALSE, badIDs = FALSE, patIsHEX = FALSE;
char *cp, argument[ 256 ];
ShellWindRec **MyShell = (ShellWindRec **) (**ShellWh).thing;
switch( ProcToken )
{
case PROC_INIT :
(**MyShell).Proc[ ProcID ].flags = TRUE;
break;
case PROC_TERM :
case PROC_BREAK :
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
break;
case PROC_STDIN :
if( (**MyShell).Proc[ ProcID ].flags )
{
(**MyShell).Proc[ ProcID ].flags = FALSE;
/* get arguments */
argc = (**MyShell).Proc[ ProcID ].argc;
greprTypes = TRUE;
greprIDs = TRUE;
greprData = TRUE;
greprCheckT = 0;
greprIDStart = 0;
greprIDEnd = 0;
greprResType = 0L; /* no type specifier */
*resName = '\0';
abortGrepr = FALSE;
for( i = 1; i < argc; i++ )
{
GetArgv( ShellWh, ProcID, i, argument );
cp = argument;
if( *cp++ == '-' )
while( *cp )
switch( *cp++ )
{
case 'h' : /* Hex */
patIsHEX = TRUE;
break;
case 'n' : /* Name */
i++;
GetArgv( ShellWh, ProcID, i, resName );
break;
case 'i' : /* id's */
i++;
if( i < argc )
{
char *cp, nc, temp[ 64 ], num[ 64 ];
int32 lnum;
GetArgv( ShellWh, ProcID, i, temp );
cp = temp;
while( *cp && (*cp != ',') )
cp++;
nc = *cp;
if( *cp )
*cp = '\0';
CtoPstr( temp );
if( GoodNum( temp ) )
{
StringToNum( temp, &lnum );
greprIDStart = (int16) lnum;
greprCheckT++;
if( nc )
{
cp++;
CtoPstr( cp );
if( GoodNum( cp ) )
{
StringToNum( cp, &lnum );
greprIDEnd = (int16) lnum;
greprCheckT++;
}
else
badIDs = TRUE;
}
}
else
badIDs = TRUE;
}
break;
case 't' : /* Type */
i++;
if( i < argc )
{
char temp[ 256 ];
GetArgv( ShellWh, ProcID, i, temp );
greprResType = StrToType( temp );
}
break;
}
}
if( badIDs )
procPrintf( ShellWh, ProcID, "grepr : bad resource ID\n" );
else
for( i = 1; i < argc; i++ )
{
GetArgv( ShellWh, ProcID, i, argument );
if( *argument != '-' )
{
if( gotPattern )
GREPRFile( ShellWh, ProcID, argument );
else
{
if( patIsHEX )
{
greprPatLen = strlen( argument ) / 2;
CtoPstr( argument );
StuffHex( grepPattern, argument );
}
else
{
strcpy( grepPattern, argument );
greprPatLen = strlen( grepPattern );
}
gotPattern = TRUE;
}
}
else
switch( argument[ 1 ] )
{
case 'n' :
case 'i' :
case 't' :
i++;
break;
}
}
/* Tell the shell that we're done */
SendOutToken( ShellWh, ProcID, PROC_BREAK );
/* Turn ourself off */
(**MyShell).Proc[ ProcID ].ProcActive = FALSE;
return( FALSE );
}
}
}